<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Promise 异常穿透</title>
</head>
<body>
    <script>
            let p =new Promise((resolve,reject)=>{
            setTimeout(()=>{
                resolve('ok');
                // reject('err');
            },1000);
        });


        // 在最后捕获错误，前面有一个发生错误即可捕获到
        p.then(value=>{
            console.log(value,'11111'); 
            // 中断 链 只有一个方式
            // 返回一个 pending 状态的 Promise
            return new Promise(()=>{}) 
        }).then(value=>{
            console.log(value,'22222'); 
            // throw('error');
        }).then(value=>{
            console.log(value,'33333'); 
        }).catch(reason=>{
            console.warn(reason);
        })
    </script>
</body>
</html>